home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
examples.arc
/
EXAMPL52.PRO
< prev
next >
Wrap
Text File
|
1986-10-07
|
970b
|
40 lines
/* program 52 */
/*
The program can handle all starting points
if you remove comments around the added
clauses. Enter the goal
route(Town1,Town2,Distance)
*/
domains
town =symbol
distance =integer
predicates
road(town,town,distance)
route(town,town,distance)
clauses
road(tampa,houston,200).
road(gordon,tampa,300).
road(houston,gordon,100).
road(houston,kansas_city,120).
road(gordon,kansas_city,130).
route(Town1,Town2,Distance):-
road(Town1,Town2,Distance).
route(Town1,Town2,Distance):-
road(Town1,X,Dist1),
route(X,Town2,Dist2),
Distance=Dist1+Dist2,!.
/* The program can handle all starting points
with these added clauses
route(Town1,Town2,Distance):-
road(Town2,Town1,Distance).
route(Town2,Town1,Distance):-
road(Town1,X,Dist1),
route(X,Town2,Dist2),
Distance=Dist1+Dist2,!.
*/